
#ifndef _WorldObject_H_
#define _WorldObject_H_

class Ship;
class Weapon;
class Map;

enum WorldObjectType {
    SHIP_WOBJECT,
    POWERUP_WOBJECT,
    WEAPON_WOBJECT,
    FLAG_WOBJECT,
    EXPLOSION_WOBJECT,
    WEAPON_PROJECTILE_WOBJECT,
};

class WorldObject {

  public:
   
    WorldObject();
    virtual ~WorldObject();
 
    virtual void render(void) = 0;
    virtual void renderMinimap(void){}

    virtual void update(void) = 0;
    virtual bool active(void) = 0; // if an object is inactive its deleted

    virtual bool resolveCollision(Ship *ship) = 0;
    virtual bool resolveCollision(Weapon *weapon) = 0;
    virtual bool resolveCollision(Map *map) = 0;

    virtual WorldObjectType getObjectType(void) const = 0;
    unsigned getId(void) const;

  protected:

    const unsigned world_uid;

};


class WorldObjectPointer {
  public:
    WorldObjectPointer();
    WorldObjectPointer(WorldObject *p);

    WorldObjectPointer(const WorldObjectPointer &obj);
    WorldObjectPointer& operator= (const WorldObjectPointer &obj);

    ~WorldObjectPointer();


    bool isValid(void) const;
    WorldObject* getPointer(void) const;

  private:
    WorldObject *p;
    unsigned id;
    bool bound;

};    


#endif

